package com.ruoyi.gbase.util;
 
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
 
public class EntityAnalyse {


    public static Object getAllObject(String tableName, String methodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {


        String tName = tableName;
        Class cls = SpringContextUtil.getBean(tName).getClass();
        Method m = cls.getDeclaredMethod(methodName);
        Object invoke = m.invoke(SpringContextUtil.getBean(tName));

        return invoke;
    }

    public static Object getOneObjectByID(String tableName, String methodName, String id) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

        String tName = tableName ;
        Class cls = SpringContextUtil.getBean(tName).getClass();
        Method m = cls.getDeclaredMethod(methodName, String.class);
        Object invoke = m.invoke(SpringContextUtil.getBean(tName), id);
        return invoke;
    }
}